package com.kc.business.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.kc.business.domain.goodsSku.BizGoodsSkuSpecs;
import com.kc.business.domain.goodsSku.BizGoodsSkuSpecsInfo;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Data
@Table(name = "kc_goods")
public class BizGoods {
    /*主键id*/
    @Id
    private Integer id;
    /*商品名称/标题*/
    @NotBlank(message = "商品名称不能为空")
    private String title;
    /*商品图片*/
    @NotBlank(message = "商品图片不能为空")
    private String thumb;
    /*商品价格，取商品规则最低价格*/
    private BigDecimal marketprice;
    /*活动价格，取商品规则最低活动价格*/
    private BigDecimal activityPrice;
    private BigDecimal costPrice;
    /*已售数量*/
    private Integer sales;
    /*实际售出数量*/
    private Integer salesreal;
    /*是否为溯源(1溯源，0非溯源)*/
    private Integer isForty;
    /*商家id(名家id)*/
    private Integer merchid;
    /*商家名称*/
    @Transient
    private String merchName;
    /*图片宽度*/
    private Integer imgWidth;
    /*图片高度*/
    private Integer imgHeight;
    /*商品状态:0下架，1上架*/
    private Integer status;
    /*商品所属景区*/
    private Integer scenicId;
    /*景区名称*/
    @Transient
    private String scenicName;
    /*商品所属APP大分类*/
    private Integer appCate;
    /*运费金额*/
    private BigDecimal expressFee;
    /*市场小店id*/
    private Integer marketBusinessId;
    /*删除标识:0未删除，1已删除*/
    private Integer isDeleted = 0;
    /*商品类别数组*/
    @NotNull(message = "请选择商品类别")
    private Integer[] goodTypes;
    /*商品详情内容*/
//    @NotBlank(message = "商品详情不能为空")
//    private String content;
    @NotNull(message = "商品详情图片不能为空")
    @Transient
    private String[] contentImgArr;
    @JsonIgnore
    private String contentImg;
    @NotNull(message = "商品轮播图片不能为空")
    @Transient
    private String[] bannerListArr = {};
    /*商品图片地址入库字段*/
    @JsonIgnore
    private String bannerList;
    @JsonIgnore
    private String bannerListAttr;
    /*商家小店名称*/
    @Transient
    private String marketBusinessName;
    /*商品类别*/
    private String categoryIds;
    /*商品规格*/
    //@NotBlank(message = "商品规格不能为空")
    private String specs = "";
    //@NotBlank(message = "商品大规格不能为空")
    private String bigSpecs;
    @NotBlank(message = "商品发货地不能为空")
    private String goodsAddress;
    /*溯源视频地址*/
    private String videoUrl;
    /*溯源视频封面图地址*/
    private String videoImg;
    /*优惠券金额*/
    @NotNull(message = "优惠券金额不能为空")
    private Double coupon;
    @NotBlank(message = "优惠券过期时间不能为空")
    private String couponEndTime;
    @NotNull(message = "排序值不能为空")
    /*排序字段*/
    private Integer sort;
    /*商品类型:0商品，1馆藏寄卖*/
    private Integer goodsType = 0;
    private Integer total = 0;
    /*是否推荐：1推荐，0不推荐*/
    @NotNull(message = "推荐状态不能为空")
    private Integer isRecommend;
    /*是否延迟结算*/
    private Integer isDelay;
    /*延迟结算天数*/
    private Integer delayDays;
    /*是否参与新用户优惠*/
    @NotNull(message = "新用户优惠标识不能为空")
    private Integer newUserDiscount;
    /*商品推荐类别*/
    @Transient
    private String[] recommendType;

    /*商品规格*/
    //@NotNull(message = "商品规格错误")
    @Transient
    private List<BizGoodsSkuSpecsInfo> skuSpecs;
    /*商品大规格*/
    //@NotNull(message = "商品大规格错误")
//    @Transient
//    private List<BizGoodsSkuSpecs> skuBigSpecs;
//    @Transient
//    private List<BizGoodsSkuSpecs> skuConfig;
    /*规格类型:0单规格，1多规格*/
    @Transient
    private Integer spaceType = 0;
    @Transient
    /*类别id,不入库*/
    private Integer goodsCategoryId = 0;
    /*发货时间*/
    @NotNull(message = "发货时间不能为空")
    @Min(value = 1,message = "发货时间错误")
    private Integer sendHour = 0;
    /*上传来源 0/自己(卡戳) 1/景区 2/名家 3/市场 4/商家*/
    private Integer entryType = 0;
    /*视频商品图片商品0图片1视频*/
    private Integer contentType = 0;

    private Integer skuCategoryId = 0;
    public BizGoods(){}
    public BizGoods(String title,String thumb, BigDecimal marketprice,Integer imgWidth, Integer imgHeight, Integer status, Integer appCate, BigDecimal expressFee,String bannerList, String videoUrl, String videoImg, Integer sort,String bannerListAttr) {
        this.title = title;
        this.thumb = thumb;
        this.marketprice = marketprice;
        this.imgWidth = imgWidth;
        this.imgHeight = imgHeight;
        this.status = status;
        this.appCate = appCate;
        this.expressFee = expressFee;
        this.bannerList = bannerList;
        this.videoUrl = videoUrl;
        this.videoImg = videoImg;
        this.sort = sort;
        this.bannerListAttr = bannerListAttr;
    }
}
